Introduction to R and Python
All files required for this lab are freely available online.
1 Before we start
Before you start downloading data from the internet, you need to create a project in R-Studio. The name of the project, as well as its file path should NOT include the following:
1. Greek letters
2. spaces (replace the spaces with _)
For example your file path could be: C:/Environmental_Data_Analysis/Geographical_Data.
You also need to install and load all the packages that we are going to use today1.
2 Install and load packages
We will need to install several libraries first.
##===========================================================================##
## Install the main packages
##===========================================================================##
install.packages('ConR'), dependencies = T)
##===========================================================================##And then we will have to load those libraries:
## ===========================================================================##
## Load them
## ===========================================================================##
pacman::p_load(tidyverse, rgbif, raster, ggspatial, rgeos, rgdal, sf, scales, scrubr,
mapr, rasterVis, ConR)
## ===========================================================================##3 Polygon data
3.1 Country boundaries
Let’s use the online database GADM to download country boundaries.
## ===========================================================================##
## Download the data for Greece
## ===========================================================================##
## There are three levels available, you are free to explore them
Greece <- getData("GADM", country = "GRC", level = 3)
## ===========================================================================#### ===========================================================================##
## Convert it to an sf spatial object
## ===========================================================================##
Greece_sf <- Greece %>% st_as_sf()
## ===========================================================================##4 Point data
4.1 Download GBIF data for a specific country
Let’s again download all the plant species that occur in Greece and are present in GBIF.
##============================================================================##
## Use the name_suggest function to get the gbif taxon key
##============================================================================##
tax_key <- name_suggest(q = "Magnoliopsida", rank = "Class")
##============================================================================##
##============================================================================##
## Sometimes groups have multiple taxon keys, so we will
## check how many records are available for them
##============================================================================##
lapply(tax_key$key, "occ_count")## list()
##============================================================================##
## The first one is relevant
##============================================================================##
tax_key <- tax_key$key[1]
##============================================================================##
##============================================================================##
## How many plant taxa occur in Greece and are present in GBIF?
##============================================================================##
occ_count(tax_key, country = "GRC")## [1] 0
##============================================================================##
## Let's download some plant species for Greece
##============================================================================##
data_gr <- occ_search(taxonKey = tax_key,
return = "data",
hasCoordinate = T, ## We only want data with coordinates
country = 'GR',
limit = 10000)$data %>%
as_tibble() ## Convert to tibble for pretty formatting4.2 Visualization
We can now start visualising the data we have downloaded. First, let’s get an idea of how many occurrences we have for each taxonomic category (taxonRank), as well as which institutions host these plant specimens/photographs (instituionCode).
## ============================================================================##
## Taxonomic rank
## ============================================================================##
data_gr %>% count(taxonRank)| taxonRank | n |
|---|---|
| FAMILY | 7 |
| FORM | 27 |
| GENUS | 46 |
| KINGDOM | 18 |
| ORDER | 1 |
| SPECIES | 9695 |
| SUBSPECIES | 201 |
| VARIETY | 5 |
## ============================================================================##
## Institution code
## ============================================================================##
data_gr %>% count(institutionCode, sort = TRUE)| institutionCode | n |
|---|---|
| iNaturalist | 5992 |
| NA | 4005 |
| naturgucker | 3 |
Now let’s see which Order, Family, Genus and Species has the most occurrences in Greece according to GBIF.
## ============================================================================##
## Order
## ============================================================================##
data_gr %>% count(order, sort = TRUE) %>% drop_na(order) %>% filter(n > 10) %>% ggplot(aes(x = reorder(order,
n), y = n, fill = order)) + geom_bar(stat = "identity", show.legend = FALSE) +
labs(x = "Order", y = "Number of Occurrence Records (observations)") + coord_flip()## ============================================================================##
## Family
## ============================================================================##
data_gr %>% count(family, sort = TRUE) %>% drop_na(family) %>% filter(n > 30) %>%
ggplot(aes(x = reorder(family, n), y = n, fill = family)) + geom_bar(stat = "identity",
show.legend = FALSE) + labs(x = "Family", y = "Number of Occurrence Records (observations)") +
coord_flip()## ============================================================================##
## Genus
## ============================================================================##
data_gr %>% count(genus, sort = TRUE) %>% drop_na(genus) %>% filter(n > 50) %>% ggplot(aes(x = reorder(genus,
n), y = n, fill = genus)) + geom_bar(stat = "identity", show.legend = FALSE) +
labs(x = "Genus", y = "Number of Occurrence Records (observations)") + coord_flip()## ============================================================================##
## Species
## ============================================================================##
data_gr %>% count(species, sort = TRUE) %>% drop_na(species) %>% filter(n > 40) %>%
ggplot(aes(x = reorder(species, n), y = n, fill = species)) + geom_bar(stat = "identity",
show.legend = FALSE) + labs(x = "Species", y = "Number of Occurrence Records (observations)") +
coord_flip()Which species of the genus Euphorbia has the most occurrences in Greece?
## ============================================================================##
## The solution
## ============================================================================##
data_gr %>% count(genus, species, sort = TRUE) %>% drop_na(species) %>% filter(genus ==
"Euphorbia") %>% filter(n > 5) %>% ggplot(aes(x = reorder(species, n), y = n,
fill = species)) + geom_bar(stat = "identity", show.legend = FALSE) + labs(x = "Euphorbia species",
y = "Number of Occurrence Records (observations)") + coord_flip()5 IUCN evaluation
Assessing the risk of extinction of a species using the standardized procedure developed by the International Union for Conservation of Nature IUCN is widely recognized as the most objective and comprehensive approach for identifying conservation priorities and targeting conservation actions. The IUCN Red List of Threatened Species provides information on the taxonomy, distribution, and conservation status of plants, fungi, and animals based on the IUCN Red List Categories and Criteria. The main aim of this procedure is to determine, using a rigorous and objective method, the risk of extinction for a species and thereby identify which species are of highest conservation concern. The IUCN Red List has been widely adopted as a standard for identifying species that require special attention when planning and implementing projects with an environmental impact (Stévart et al., 2019).
Generating IUCN Red List assessments must be done on a species-by-species basis and requires both reliable data and the careful, knowledgeable application of the Red List criteria, a process that takes considerable time. This is reflected by the fact that there are substantial gaps in the Red List: only 28,114 vascular plant species have been assessed to date. This knowledge gap results, in large part, from their very high level of species diversity, making it a time-consuming proposition to evaluate the threats they face. Hence, while the IUCN is on track to achieve its target of 38,500 plant species assessments on the Red List by 2020 (Bachman et al., 2018), this would only reach 10% of Global Strategy for Plant Conservation Target 2 (see here as well), a situation that has led to calls for complementary methods to speed up the process of assessing the conservation status of the world’s flora.
Recently, a fast, efficient and complementary approach that is grounded in key elements of the IUCN conservation assessment process and aims to provide useful information on the conservation status of large numbers of species in the form of Preliminary Automated Conservation Assessments (PACA) has been proposed. PACA can facilitate analyses of the level of conservation concern of a large number of species or of the entire flora of a given area and can help identify species that are likely to be threatened and therefore may require additional attention, including full Red List assessments (Dauby et al., 2017; Stévart et al., 2019).
Today, we will make use of the PACA approach.
##============================================================================##
## First, let's select only the required columns
##============================================================================##
data_gr_sel <- data_gr %>% dplyr::select(decimalLatitude, decimalLongitude,
scientificName)
##============================================================================##
##============================================================================##
## Then, let's evaluate our taxa
##============================================================================##
greece_iucn_eval <- IUCN.eval(data_gr_sel,
## Here we use the spatial object for the country
## we want
country_map = Greece,
## We can run the function in parallel to save
## time
parallel = T,
## Change the number of cores accordingly
NbeCores = 23 ) %>%
## Here we create a new column (EOO_tr) and we substitute the NA values with
## the values from the AOO column (Why?)
mutate(EOO_tr = ifelse(is.na(EOO),
AOO,
EOO)) %>%
as_tibble() %>%
dplyr::select(taxa,
EOO_tr,
everything())##
|
| | 0%
|
| | 1%
|
|= | 1%
|
|= | 2%
|
|== | 2%
|
|== | 3%
|
|== | 4%
|
|=== | 4%
|
|=== | 5%
|
|==== | 5%
|
|==== | 6%
|
|===== | 6%
|
|===== | 7%
|
|===== | 8%
|
|====== | 8%
|
|====== | 9%
|
|======= | 9%
|
|======= | 10%
|
|======= | 11%
|
|======== | 11%
|
|======== | 12%
|
|========= | 12%
|
|========= | 13%
|
|========= | 14%
|
|========== | 14%
|
|========== | 15%
|
|=========== | 15%
|
|=========== | 16%
|
|============ | 16%
|
|============ | 17%
|
|============ | 18%
|
|============= | 18%
|
|============= | 19%
|
|============== | 19%
|
|============== | 20%
|
|============== | 21%
|
|=============== | 21%
|
|=============== | 22%
|
|================ | 22%
|
|================ | 23%
|
|================ | 24%
|
|================= | 24%
|
|================= | 25%
|
|================== | 25%
|
|================== | 26%
|
|=================== | 26%
|
|=================== | 27%
|
|=================== | 28%
|
|==================== | 28%
|
|==================== | 29%
|
|===================== | 29%
|
|===================== | 30%
|
|===================== | 31%
|
|====================== | 31%
|
|====================== | 32%
|
|======================= | 32%
|
|======================= | 33%
|
|======================= | 34%
|
|======================== | 34%
|
|======================== | 35%
|
|========================= | 35%
|
|========================= | 36%
|
|========================== | 36%
|
|========================== | 37%
|
|========================== | 38%
|
|=========================== | 38%
|
|=========================== | 39%
|
|============================ | 39%
|
|============================ | 40%
|
|============================ | 41%
|
|============================= | 41%
|
|============================= | 42%
|
|============================== | 42%
|
|============================== | 43%
|
|============================== | 44%
|
|=============================== | 44%
|
|=============================== | 45%
|
|================================ | 45%
|
|================================ | 46%
|
|================================= | 46%
|
|================================= | 47%
|
|================================= | 48%
|
|================================== | 48%
|
|================================== | 49%
|
|=================================== | 49%
|
|=================================== | 50%
|
|=================================== | 51%
|
|==================================== | 51%
|
|==================================== | 52%
|
|===================================== | 52%
|
|===================================== | 53%
|
|===================================== | 54%
|
|====================================== | 54%
|
|====================================== | 55%
|
|======================================= | 55%
|
|======================================= | 56%
|
|======================================== | 56%
|
|======================================== | 57%
|
|======================================== | 58%
|
|========================================= | 58%
|
|========================================= | 59%
|
|========================================== | 59%
|
|========================================== | 60%
|
|========================================== | 61%
|
|=========================================== | 61%
|
|=========================================== | 62%
|
|============================================ | 62%
|
|============================================ | 63%
|
|============================================ | 64%
|
|============================================= | 64%
|
|============================================= | 65%
|
|============================================== | 65%
|
|============================================== | 66%
|
|=============================================== | 66%
|
|=============================================== | 67%
|
|=============================================== | 68%
|
|================================================ | 68%
|
|================================================ | 69%
|
|================================================= | 69%
|
|================================================= | 70%
|
|================================================= | 71%
|
|================================================== | 71%
|
|================================================== | 72%
|
|=================================================== | 72%
|
|=================================================== | 73%
|
|=================================================== | 74%
|
|==================================================== | 74%
|
|==================================================== | 75%
|
|===================================================== | 75%
|
|===================================================== | 76%
|
|====================================================== | 76%
|
|====================================================== | 77%
|
|====================================================== | 78%
|
|======================================================= | 78%
|
|======================================================= | 79%
|
|======================================================== | 79%
|
|======================================================== | 80%
|
|======================================================== | 81%
|
|========================================================= | 81%
|
|========================================================= | 82%
|
|========================================================== | 82%
|
|========================================================== | 83%
|
|========================================================== | 84%
|
|=========================================================== | 84%
|
|=========================================================== | 85%
|
|============================================================ | 85%
|
|============================================================ | 86%
|
|============================================================= | 86%
|
|============================================================= | 87%
|
|============================================================= | 88%
|
|============================================================== | 88%
|
|============================================================== | 89%
|
|=============================================================== | 89%
|
|=============================================================== | 90%
|
|=============================================================== | 91%
|
|================================================================ | 91%
|
|================================================================ | 92%
|
|================================================================= | 92%
|
|================================================================= | 93%
|
|================================================================= | 94%
|
|================================================================== | 94%
|
|================================================================== | 95%
|
|=================================================================== | 95%
|
|=================================================================== | 96%
|
|==================================================================== | 96%
|
|==================================================================== | 97%
|
|==================================================================== | 98%
|
|===================================================================== | 98%
|
|===================================================================== | 99%
|
|======================================================================| 99%
|
|======================================================================| 100%
## [1] "Number of species per category"
##
## CR EN LC or NT VU
## 1143 520 86 111
## [1] "Ratio of species per category"
##
## CR EN LC or NT VU
## 61.5 28.0 4.6 6.0
##============================================================================##
## Let's see the result
##============================================================================##
# greece_iucn_evalSo there you have it. We have assessed the extinction risk status of all the taxa we have downloaded from GBIF. Please bear in mind that this is for demonstration purposes only. If we wanted to publish our results, we would have to perform a cleaning procedure, take special care of the taxonomic conflicts (if any) and make sure to remove any alien species (among many other things).
We can also compute and store into our disk the EOO polygons for each taxon, based on the convex- and alpha-hull methods (You could read this paper if you want to see which method is better).
##============================================================================##
## First we run the convex-hull method
##============================================================================##
eooshp_convexhull <- EOO.computing(data_gr_sel,
exclude.area = T,
country_map = Greece,
export_shp = T,
write_shp = T,
Name_Sp = 'scientificName',
parallel = T,
NbeCores = 4, ## Change them
show_progress = T,
method.less.than3 = 'arbitrary') ## What does this option mean?
convexhull <- eooshp_convexhull$spatial.polygon_1
##============================================================================##
##============================================================================##
## Then the alpha-hull method
##============================================================================##
eooshp_ahull <- EOO.computing(data_gr_sel,
exclude.area = T,
country_map = Greece,
export_shp = T,
write_shp = T,
Name_Sp = 'scientificName',
parallel = T,
NbeCores = 4, ## Change them
show_progress = T,
method.less.than3 = 'arbitrary',
method.range = 'alpha.hull')
ahull <- eooshp_ahull$spatial.polygon_1
##============================================================================##5.1 Spatial patterns of the IUCN evaluation
Let’s see now which Greek county hosts the highest percentage of endangered plant species.
##============================================================================##
## First create a common column and then join the occurrences with the
## evaluations
##============================================================================##
greece_iucn_eval$scientificName <- greece_iucn_eval$taxa
data_joined <- full_join(data_gr, greece_iucn_eval)
##============================================================================##
##============================================================================##
## Then select only the endangered taxa (CR, EN, VU)
##============================================================================##
endangered <- data_joined %>% filter(!str_detect(Category_code, 'LC'))
##============================================================================##
##============================================================================##
## Convert Greece to an sf spatial object
##============================================================================##
Greece_sf <- Greece %>% st_as_sf()
##============================================================================##
##============================================================================##
## Convert the endangered species to a sf spatial object
##============================================================================##
data_gr_sf <- st_as_sf(endangered, coords = c("decimalLongitude", "decimalLatitude"),
crs = 4326)
##============================================================================##
##============================================================================##
## Make sure that all these occurrences lie within Greece
##============================================================================##
point_endangered <- data_gr_sf[Greece_sf,]
##============================================================================##
##============================================================================##
## Intersect Greece with these occurrences
##============================================================================##
endangered_intersection <- Greece_sf %>%
st_join(point_endangered) %>%
group_by(NAME_3) %>% ## Here we group the data based on the county names
## First we create a variable containing the sum of the species in each county
summarize(Species_Number = sum(NROW(unique(scientificName))),
## Then we just sum the number of occurrences in each county
Occurrence_Number = n(),
## Finally, we calculate the proportion of the endangered species in
## each county
Risk = sum(NROW(unique(scientificName)))/sum(NROW(unique(data_joined$scientificName)))*100
)
##============================================================================##
##============================================================================##
## And we finally plot it
##============================================================================##
ggplot(Greece_sf) +
geom_sf(fill = "antiquewhite1") +
geom_sf() +
geom_sf(data = Greece_sf,
fill = NA) +
geom_sf(aes(fill = Risk),
data = endangered_intersection,
inherit.aes = FALSE) +
theme(axis.title = element_blank(),
legend.position = "bottom") +
scale_fill_viridis_c(option = "viridis", trans = "sqrt")Which county has the most species?
6 Homework
Please submit your answer at this email in PDF format.
- Download biotic (i.e., for any type of organism: animal or plant) data for any country you want.
- Which Order, Family, Genus and Species has the most occurrences? Present that visually.
- Evaluate those taxa according to the IUCN Criterion B. How many species are under each IUCN category?
- Which county has the highest percentage of endangered species? Present that visually.
7 Appendix: R code
##===========================================================================##
## Do NOT run this code
##===========================================================================##
## Global options
options(Encoding="UTF-8")
library(knitr)
library(rmdformats)
## Global options
options(max.print="75")
opts_chunk$set(echo=TRUE,
cache=TRUE,
prompt=FALSE,
tidy=TRUE,
# comment=NA,
message=FALSE,
warning=FALSE,
eval = TRUE)
opts_knit$set(width=75)
##===========================================================================##
pre {
max-height: 400px;
overflow-y: auto;
}
pre[class] {
max-height: 400px;
}
##===========================================================================##
## Install the main packages
##===========================================================================##
install.packages('ConR'), dependencies = T)
##===========================================================================##
##===========================================================================##
## Load them
##===========================================================================##
pacman::p_load(tidyverse, rgbif, raster, ggspatial,
rgeos, rgdal,sf, scales,
scrubr, mapr, rasterVis, ConR)
##===========================================================================##
##===========================================================================##
## Download the data for Greece
##===========================================================================##
## There are three levels available, you are free to explore them
Greece <- getData('GADM', country = 'GRC', level = 3)
##===========================================================================##
##===========================================================================##
## Convert it to an sf spatial object
##===========================================================================##
Greece_sf <- Greece %>% st_as_sf()
##===========================================================================##
##============================================================================##
## Use the name_suggest function to get the gbif taxon key
##============================================================================##
tax_key <- name_suggest(q = "Magnoliopsida", rank = "Class")
##============================================================================##
##============================================================================##
## Sometimes groups have multiple taxon keys, so we will
## check how many records are available for them
##============================================================================##
lapply(tax_key$key, "occ_count")
##============================================================================##
## The first one is relevant
##============================================================================##
tax_key <- tax_key$key[1]
##============================================================================##
##============================================================================##
## How many plant taxa occur in Greece and are present in GBIF?
##============================================================================##
occ_count(tax_key, country = "GRC")
##============================================================================##
## Let's download some plant species for Greece
##============================================================================##
data_gr <- occ_search(taxonKey = tax_key,
return = "data",
hasCoordinate = T, ## We only want data with coordinates
country = 'GR',
limit = 10000)$data %>%
as_tibble() ## Convert to tibble for pretty formatting
##============================================================================##
## Taxonomic rank
##============================================================================##
data_gr %>% count(taxonRank)
##============================================================================##
## Institution code
##============================================================================##
data_gr %>% count(institutionCode, sort = TRUE)
##============================================================================##
## Order
##============================================================================##
data_gr %>%
count(order, sort = TRUE) %>%
drop_na(order) %>%
filter(n > 10) %>%
ggplot(aes(x = reorder(order, n), y = n, fill = order)) +
geom_bar(stat = "identity", show.legend = FALSE) +
labs(x = "Order", y = "Number of Occurrence Records (observations)") +
coord_flip()
##============================================================================##
## Family
##============================================================================##
data_gr %>%
count(family, sort = TRUE) %>%
drop_na(family) %>%
filter(n > 30) %>%
ggplot(aes(x = reorder(family, n), y = n, fill = family)) +
geom_bar(stat = "identity", show.legend = FALSE) +
labs(x = "Family", y = "Number of Occurrence Records (observations)") +
coord_flip()
##============================================================================##
## Genus
##============================================================================##
data_gr %>% count(genus, sort = TRUE) %>%
drop_na(genus) %>%
filter(n > 50) %>%
ggplot(aes(x = reorder(genus, n), y = n, fill = genus)) +
geom_bar(stat = "identity",
show.legend = FALSE) +
labs(x = "Genus",
y = "Number of Occurrence Records (observations)") +
coord_flip()
##============================================================================##
## Species
##============================================================================##
data_gr %>%
count(species, sort = TRUE) %>%
drop_na(species) %>%
filter(n > 40) %>%
ggplot(aes(x = reorder(species, n), y = n, fill = species)) +
geom_bar(stat = "identity", show.legend = FALSE) +
labs(x = "Species", y = "Number of Occurrence Records (observations)") +
coord_flip()
##============================================================================##
## The solution
##============================================================================##
data_gr %>% count(genus, species, sort = TRUE) %>%
drop_na(species) %>%
filter(genus == 'Euphorbia') %>%
filter(n > 5) %>%
ggplot(aes(x = reorder(species, n), y = n, fill = species)) +
geom_bar(stat = "identity",
show.legend = FALSE) +
labs(x = "Euphorbia species",
y = "Number of Occurrence Records (observations)") +
coord_flip()
##============================================================================##
## First, let's select only the required columns
##============================================================================##
data_gr_sel <- data_gr %>% dplyr::select(decimalLatitude, decimalLongitude,
scientificName)
##============================================================================##
##============================================================================##
## Then, let's evaluate our taxa
##============================================================================##
greece_iucn_eval <- IUCN.eval(data_gr_sel,
## Here we use the spatial object for the country
## we want
country_map = Greece,
## We can run the function in parallel to save
## time
parallel = T,
## Change the number of cores accordingly
NbeCores = 23 ) %>%
## Here we create a new column (EOO_tr) and we substitute the NA values with
## the values from the AOO column (Why?)
mutate(EOO_tr = ifelse(is.na(EOO),
AOO,
EOO)) %>%
as_tibble() %>%
dplyr::select(taxa,
EOO_tr,
everything())
##============================================================================##
## Let's see the result
##============================================================================##
# greece_iucn_eval
##============================================================================##
## First we run the convex-hull method
##============================================================================##
eooshp_convexhull <- EOO.computing(data_gr_sel,
exclude.area = T,
country_map = Greece,
export_shp = T,
write_shp = T,
Name_Sp = 'scientificName',
parallel = T,
NbeCores = 4, ## Change them
show_progress = T,
method.less.than3 = 'arbitrary') ## What does this option mean?
convexhull <- eooshp_convexhull$spatial.polygon_1
##============================================================================##
##============================================================================##
## Then the alpha-hull method
##============================================================================##
eooshp_ahull <- EOO.computing(data_gr_sel,
exclude.area = T,
country_map = Greece,
export_shp = T,
write_shp = T,
Name_Sp = 'scientificName',
parallel = T,
NbeCores = 4, ## Change them
show_progress = T,
method.less.than3 = 'arbitrary',
method.range = 'alpha.hull')
ahull <- eooshp_ahull$spatial.polygon_1
##============================================================================##
##============================================================================##
## First create a common column and then join the occurrences with the
## evaluations
##============================================================================##
greece_iucn_eval$scientificName <- greece_iucn_eval$taxa
data_joined <- full_join(data_gr, greece_iucn_eval)
##============================================================================##
##============================================================================##
## Then select only the endangered taxa (CR, EN, VU)
##============================================================================##
endangered <- data_joined %>% filter(!str_detect(Category_code, 'LC'))
##============================================================================##
##============================================================================##
## Convert Greece to an sf spatial object
##============================================================================##
Greece_sf <- Greece %>% st_as_sf()
##============================================================================##
##============================================================================##
## Convert the endangered species to a sf spatial object
##============================================================================##
data_gr_sf <- st_as_sf(endangered, coords = c("decimalLongitude", "decimalLatitude"),
crs = 4326)
##============================================================================##
##============================================================================##
## Make sure that all these occurrences lie within Greece
##============================================================================##
point_endangered <- data_gr_sf[Greece_sf,]
##============================================================================##
##============================================================================##
## Intersect Greece with these occurrences
##============================================================================##
endangered_intersection <- Greece_sf %>%
st_join(point_endangered) %>%
group_by(NAME_3) %>% ## Here we group the data based on the county names
## First we create a variable containing the sum of the species in each county
summarize(Species_Number = sum(NROW(unique(scientificName))),
## Then we just sum the number of occurrences in each county
Occurrence_Number = n(),
## Finally, we calculate the proportion of the endangered species in
## each county
Risk = sum(NROW(unique(scientificName)))/sum(NROW(unique(data_joined$scientificName)))*100
)
##============================================================================##
##============================================================================##
## And we finally plot it
##============================================================================##
ggplot(Greece_sf) +
geom_sf(fill = "antiquewhite1") +
geom_sf() +
geom_sf(data = Greece_sf,
fill = NA) +
geom_sf(aes(fill = Risk),
data = endangered_intersection,
inherit.aes = FALSE) +
theme(axis.title = element_blank(),
legend.position = "bottom") +
scale_fill_viridis_c(option = "viridis", trans = "sqrt")
##===========================================================================##
## Do NOT run this code
##===========================================================================##
labs = knitr::all_labels(echo = TRUE)
##===========================================================================##References
Bachman, S.P., Nic Lughadha, E.M., & Rivers, M.C. (2018) Quantifying progress toward a conservation assessment for all plants. Conservation biology, 32, 516–524.
Dauby, G., Stévart, T., Droissart, V., Cosiaux, A., Deblauwe, V., Simo-Droissart, M., Sosef, M.S., Lowry, P.P., Schatz, G.E., Gereau, R.E., & others (2017) ConR: An r package to assist large-scale multispecies preliminary conservation assessments using distribution data. Ecology and evolution, 7, 11292–11303.
Stévart, T., Dauby, G., Lowry, P., Blach-Overgaard, A., Droissart, V., Harris, D., Mackinder, B., Schatz, G., Sonké, B., Sosef, M., & others (2019) A third of the tropical african flora is potentially threatened with extinction. Science Advances, 5, eaax9444.
There are two ways to do that fast:
1.library(pacman); p_load('package_name_1', 'package_name_2')
2.install.packages(c('package_name_1', 'package_name_2'), dependecies = TRUE)
Remember that if you use the first way, you need to install packagepacmanfirst.↩